package com.zym.init.controller.backend;

import com.zym.init.core.annotation.ApiBackendRestController;
import com.zym.init.core.annotation.Log;
import com.zym.init.core.controller.BaseController;
import com.zym.init.core.domain.AjaxResult;
import com.zym.init.model.query.OperationLogQuery;
import com.zym.init.service.OperationLogService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 操作日志控制器
 */
@Validated
@ApiBackendRestController
@RequestMapping(path = "/operation_log", produces = "application/json")
public class OperationLogController extends BaseController {

    private final OperationLogService operationLogService;

    public OperationLogController(OperationLogService operationLogService) {
        this.operationLogService = operationLogService;
    }

    /**
     * 获取操作日志列表
     */
    @Log(title = "获取操作日志列表")
    @PreAuthorize("@ss.hasPermission('system:operationLog:list')")
    @GetMapping
    public AjaxResult list(OperationLogQuery query) {
        return success("获取成功", operationLogService.getPage(query));
    }

}
